Ext.onReady(function(){
		var f = new Ext.form.FormPanel({
			//数据传送到服务器的配置
		url: "login/login.do",
		method: "post",
		title: "欢迎登陆",
		height:180,
		autoHeight: true,
		labelAlign : 'right',
		bodyStyle: "padding: 6px",
		defaultType: "textfield",//默认组件类型
		 defaults : {
                width : 300,
                labelWidth:80
            },
		frame: true,
		items: [
			{
				name: "username",
				allowBlank: false, //不允许为空
				fieldLabel: "用户名"
			},{
				name: "password",
				inputType: "password",
				fieldLabel: "密码",
				allowBlank: false //不允许为空
			},{
				id:"checkcode",
				fieldLabel: "验证码"
			}
		],
		buttons:[{
			text: "确定",
			handler: function(){
				var username = f.getForm().findField("username").getValue();
				var password = f.getForm().findField("password").getValue();
				var checkcode= f.getForm().findField("checkcode").getValue();
				var p={username:username,password:password,checkcode:checkcode};
				//提交表单
				f.getForm().submit({
					method:'POST',
					params:p,
                    waitMsg: '正在提交...',
					success: function(f, action){
						window.location="module/index/index.html";
					},
					failure : function(form, action) {
							Ext.Msg.alert('提示', action.result.msg);
						}
				});
			}
		},
		{
			text: "重置",
			handler: function(){
				//f.getForm().reset();
				var fields = f.getForm().items.items;
				for(var i = 0; i < fields.length; i ++){
					fields[i].reset();					
				}
			}
		}]
	});
	
	f.render("a");
	
	var bd = Ext.getDom('checkcode');    
	var bd2 = Ext.get(bd.parentNode);   
	bd2.createChild({tag: 'img', src: 'checkcode.jsp',align:'absbottom'});                                           
})